﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiConveyorInput_Internal : OdGiConveyorInput, IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiConveyorInput_Internal(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiConveyorInput_Internal obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiConveyorInput_Internal()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiConveyorInput_Internal(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		HandleRef OdGiConveyorInput.GetCPtr()
		{
			return new HandleRef(this, GlobalsPINVOKE.OdGiConveyorInput_Internal_OdGiConveyorInput_GetCPtr(this.swigCPtr.Handle));
		}

		public virtual void addSourceNode(OdGiConveyorOutput sourceNode)
		{
			GlobalsPINVOKE.OdGiConveyorInput_Internal_addSourceNode(this.swigCPtr, sourceNode.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeSourceNode(OdGiConveyorOutput sourceNode)
		{
			GlobalsPINVOKE.OdGiConveyorInput_Internal_removeSourceNode(this.swigCPtr, sourceNode.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
